package com.karina.visualization.chart.component;

import com.karina.visualization.chart.client.DisplayObject;
import com.karina.visualization.chart.client.Series;
import com.karina.visualization.chart.model.CategorizedSeriesModel;
import com.karina.visualization.chart.model.ShapeModel;
import com.karina.visualization.chart.skins.LineSkin;

public class LineSeries extends ChartObject<CategorizedSeriesModel, LineSkin>
		implements Series<CategorizedSeriesModel> {

	public LineSeries(CategorizedSeriesModel model) {
		super(model, new LineSkin());
	}

	public LineSeries(CategorizedSeriesModel model, LineSkin skin) {
		super(model, skin);
	}

	@Override
	protected void caculateChartObjectModelProperties() {
		DisplayObject<?> parent = getParent();
		if (parent != null) {
			ShapeModel<?> parentModel = (ShapeModel<?>) parent.getData();
			getData().setHeight(parentModel.getHeight());
			getData().setX(parentModel.getX());
			getData().setY(parentModel.getY());
		}
	}

	@Override
	public String getSelectorName() {
		return "LineSeries#" + getData().getName();
	}

}
